#ifndef __USR_LOW_POWER_H
#define __USR_LOW_POWER_H
#include "main.h"

typedef struct
{
    uint8_t status;   /// 0:未休眠 1：休眠中
    uint16_t in_cnt;  /// 进低功耗计数
    uint16_t out_cnt; /// 出低功耗计数
    bool pre_quit_flag;
    luat_rtos_mutex_t mutex;
} SLEEP_STATE_INFO_T;

void usr_enter_low_power(void);
void usr_quit_low_power(void);
void sleep_in_count_dec(SLEEP_STATE_INFO_T *sleep);
void sleep_in_count_add(SLEEP_STATE_INFO_T *sleep);
void sleep_out_count_dec(SLEEP_STATE_INFO_T *sleep);
void sleep_out_count_add(SLEEP_STATE_INFO_T *sleep);
uint16_t get_sleep_in_count(SLEEP_STATE_INFO_T *sleep);
uint16_t get_sleep_out_count(SLEEP_STATE_INFO_T *sleep);
void clear_sleep_count(SLEEP_STATE_INFO_T *sleep);
void low_power_init(void);
bool get_pre_quit_flag(SLEEP_STATE_INFO_T *sleep);
void set_pre_quit_flag(SLEEP_STATE_INFO_T *sleep, bool flag);

#endif /* __USR_LOW_POWER_H */
